package ${package}.ws;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;

/**
 * 统一的带错误码与错误信息定义的WebService专用异常. 
 * 
 * 继承于Exception,在SOAP中将转化为与语言无关的fault节点,在web service client根据自身的异常机制转化为相应的类.
 * 
 * @author calvin
 */
@SuppressWarnings("serial")
@XmlAccessorType(XmlAccessType.FIELD)
public class FaultException extends Exception {

	private String code;

	private String faultMessage;

	/**
	 * @param code 错误代码
	 * @param faultMessage 错误信息
	 */
	public FaultException(String code, String faultMessage) {
		super(code + ":" + faultMessage);
		this.code = code;
		this.faultMessage = faultMessage;
	}

	public FaultException(String faultMessage) {
		super(faultMessage);
		this.faultMessage = faultMessage;
	}

	public String getCode() {
		return code;
	}

	public String getFaultMessage() {
		return faultMessage;
	}
}